$(function() {
	$.ajax({
        cache : true,
        type : "get",
        headers:getRequestHears(),
        url : window.API_SERVER_URL + "sys/menu/myMenus",
        async : false,
        success : function(data) { 
            //遍历向div中添加查询到的菜单  
            for (var n = 0; n < data.length; n++) {  
                var id = data[n].id//子菜单div的动态id  
                $("#side-menu").append('<li><a id="MenuName" index="' + n + '"><i class="' + data[n].attributes.icon +'"></i><span class="nav-label">' + data[n].text + '</span><span class="fa arrow"></span></a><ul class="nav nav-second-level" id="' + id + '"></ul></li>')  
  				var data2 = data[n].children;
                for (var i = 0; i < data2.length; i++) {  
                    if (data[n].id == data2[i].parentId) {  
                        $("#" + id + "").append('<li><a class="J_menuItem"  href="'+ data2[i].attributes.url + '"><i class="' + data2[i].attributes.icon +'"></i>' + data2[i].text + '</a></li>')  
                    }  
                }  
            }              
        }
    });
});